package platform;

import platform.cmdexecutor.PlatformCommandExecutor;
import platform.hwinfofetcher.HardwareInfoFetcher;
import platform.upgrader.PlayerUpgrader;

public abstract class PlatformObjectFactory {
	private static PlatformObjectFactory _instance;

	public static PlatformObjectFactory getInstance() {
		if (_instance == null) {
			PlatformObjectFactory classFactory = null;
			switch (Platform.getPlatform()) {
				case WINDOWS:
					classFactory = WindowsPlatformObjectFactory.getInstance();
					break;
				case MAC:
					classFactory = MacPlatformObjectFactory.getInstance();
					break;
				case LINUX:
					classFactory = LinuxPlatformObjectFactory.getInstance();
					break;
				default:
					System.err.println("Unknown operating system.");
			}
			_instance = classFactory;
		}
		return _instance;
	}

	public abstract PlatformCommandExecutor getCommandExecutor();

	public abstract PlayerUpgrader getPlayerUpgrader();
	
	public abstract HardwareInfoFetcher getHardwareInfoFetcher();
}
